Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var atype = 'digital'
- var activity_uuid = 'a039z8f9-24e5-495c-a894-a044c767c49a'
- var body2 = {
- "data": {
- "type": "my_activity--"+atype,
- "id": activity_uuid,
- "attributes": {
- 'id': 18,
- 'uuid': activity_uuid,
- 'notes': 'some debug text if you have a notes field'
- },
- "relationships": {
- "type": {
- "data": {
- "type": "my_activity_type--my_activity_type",
- "id": "109e0f74-1995-4836-a044-7fc40f05b39c"
- },
- "links": {
- "self": "http://me.net/my_activity/digital/"+activity_uuid+"/relationships/type",
- "related": "http://me.net/my_activity/digital/"+activity_uuid+"/type"
- }
- },
- "products": {
- "data": [
- {
- "type": "paragraph--products",
- "id": "42c0aba4-0e5c-411d-99e0-63305b66c1ef",
- "meta": {
- "target_revision_id": "11" // A revision of this product.
- }
- },
- {
- "type": "paragraph--products",
- "id": "3da8f866-346e-4386-acc5-18040949828e",
- "meta": {
- "target_revision_id": "13"
- }
- }
- ],
- "links": {
- "self": "http://me.net/my_activity/digital/"+activity_uuid+"/relationships/products",
- "related": "http://me.net/my_activity/digital/"+activity_uuid+"/products"
- }
- }
- }
- }
- }
- try {
- init = {
- method: 'PATCH',
- headers: {
- 'Authorization': 'Bearer '+auth.access_token,
- 'Content-Type': 'application/vnd.api+json',
- },
- body: JSON.stringify(body2),
- };
- // Some fetch implementation.
- _fetch(this, '/my_activity/'+atype+'/'+activity_uuid, init)
- } catch(error) {
- // Something.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement